/**
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-07 19:44:55
 * Copyright (c) 2015- joysuch-版权所有
 */

package com.joysuch.wwyt.bp.service;

import com.joysuch.wwyt.bp.bean.*;
import com.joysuch.wwyt.bp.bean.MhRiskBroadcastBean.SafetyWorkCertStats;
import com.joysuch.wwyt.bp.bean.safetyworkcert.BpWorkSafetyCertEditBaseBean;
import com.joysuch.wwyt.bp.bean.safetyworkcert.BpWorkSafetyCertSearchBean;
import com.joysuch.wwyt.bp.entity.BpWorkSafetyAuditTemplate;
import com.joysuch.wwyt.bp.entity.BpWorkSafetyCert;
import com.joysuch.wwyt.bp.entity.BpWorkSafetyCertType;
import com.joysuch.wwyt.bp.entity.BpWorkSafetyMethodConfig;
import com.joysuch.wwyt.bp.enums.SafetyWorkTypes;
import com.joysuch.wwyt.core.bean.SimpleSelectListBean;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.exception.BusinessRestrictionsException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface BpWorkSafetyCertService {

    public BpWorkSafetyCert addFireCert(BpWorkSafetyApplyFireAddBean entity) throws Exception;

    public BpWorkSafetyCert add(BpWorkSafetyCertEditBaseBean entity, SafetyWorkTypes type, String module);

    // module 为安全作业证名称
    BpWorkSafetyCert update(BpWorkSafetyCertEditBaseBean entity, SafetyWorkTypes type, String module) throws Exception;

    BpWorkSafetyCert updateFireCert(BpWorkSafetyApplyFireAddBean entity) throws Exception;

    Page<BpWorkSafetyApplyFireListBean> findByPage(Pageable page, BpWorkSafetyCertSearchBean condition,
                                                   SafetyWorkTypes type);

    Page<BpWorkSafetyApplyFireListBean> findByPageFire(Pageable page, BpWorkSafetyCertSearchBean condition);

    void delete(Long id) throws BusinessRestrictionsException;

    BpWorkSafetyCert findById(Long id);

    public BpWorkSafetyCertDetailBean getById(Long id);

    public BpWorkSafetyApplyFireEditBean findDetailByIdFire(Long id);

    public int specialWorkCount();

    /**
     * 统计指定时间内，进行中的工作证数量。
     * 左闭右开区间（ $time >= start && $time < end)
     *
     * @param start 开始时间(包含)
     * @param end   结束时间(不包含)
     * @return
     */
    public SafetyWorkCertStats statsInProgressionCertsBetweenTime(Date start, Date end);

    Map<String, Object> pointAssessmenPrint(String code);

    ResultBean todayCert();

    ResultBean certSummary();

    Long saveIdentify(BpWorkSafetyIdentifyBean bean);

    BpWorkSafetyIdentifyBean getIdentifyById(Long id);

    Long saveStep(BpWorkSafetySigenerBean bean);

    List<BpWorkSafetySigenerBean> getStep(Long certId);

    //Long saveFileAnalyze(BpWorkSafetyFileAnalyzeBean bean);

    Long saveAppFileAnalyze(BpWorkSafetyFileAnalyzeBean bean, BpWorkSafetyCert cert);

    List<BpWorkSafetyFileAnalyzeBean> getFileAnalyze(Long analyzeId);

    List<BpWorkSafetySpaceAnalyzeBean> getSpaceAnalyze(Long certId);

    List<BpWorkSafetySigenerBean> getSigner(Long certId, Integer categoryId);

    Long saveSpaceAnalyze(BpWorkSafetySpaceAnalyzeBean bean,BpWorkSafetyCert cert);

    void deleteFileAnalyze(Long id);

    void deleteSpaceAnalyze(Long id);

    Long saveSinger(BpWorkSafetySigenerAddBean bean, BpWorkSafetyCert cert);

    List<BpWorkSafetySigenerAddBean> getAppSigner(Long certId);

    void appAudit(Long certId, Date sTime, Date eTime, String checkMessage);

    Integer checkApp(BpWorkSafetyAppAuditBean bean);

    BpWorkSafetyAppAuditBean getAppCheckById(Long certId);

    ResultBean getAppApplyList(Pageable pageable);

    ResultBean getAppWaitAuditList(Pageable pageable,String codeOrLevel,Integer state);

    BpWorkSafetyAuditTemplate addTemplate(BpWorkSafetyAuditTemplateBean bean);

    BpWorkSafetyAuditTemplate updateTemplate(BpWorkSafetyAuditTemplateBean bean);

    BpWorkSafetyAuditTemplateBean findTemplateById(Long templateId);

    void safetyAudit(BpWorkSafetyWebAuditBean bean);

    ResultBean getAppWaitCheckList(Pageable pageable);

    BpWorkSafetyAppAuditListBean getAppAuditById(Long certId);

    List<BpWorkSafetyAuditTemplateBean> findTemplateList();

    Map<String, Object> getFileSafetyMap(Long id) throws IOException;

    Map<String, Object> getSpaceSafetyMap(Long id) throws IOException;

    Map<String, Object> getSafetyMap(Long id, String type) throws IOException;

    Map<String, Object> getLinshiSafetyMap(Long id) throws IOException;

    Map<String, Object> getHighSafetyMap(Long id) throws IOException;

    Map<String, Object> getDiaoZhuangSafetyMap(Long id) throws IOException;

    Map<String, Object> getMangBanSafetyMap(Long id) throws IOException;

    Map<String, Object> getDongTuSafetyMap(Long id) throws IOException;

    Map<String, Object> getDuanLuSafetyMap(Long id) throws IOException;

    ResultBean workPrescription();

    ResultBean workToday();

    ResultBean workApply();

    ResultBean work30Recent();

    ResultBean workAuditPass();

    ResultBean workCheckPass();

    List<BpWorkSafetyMethodConfig> saveMethodTemplate(List<BpWorkSafetyMethodConfigBean> list);

    List<BpWorkSafetyMethodConfigBean> getMethodTemplateList(String type);

    ResultBean workRisk();

    ResultBean workArea();

    ResultBean workTimeScope();

    void deleteMethodTemplate(Long id);

    ResultBean getWaitForAuditList(Pageable pageable);

    ResultBean getWaitForCheckList(Pageable pageable);

    void updateTemplateState(Long id, Integer state);

    List<BpWorkSafetyCertType> getWorkCertType();

    List<SimpleSelectListBean> getSafetyTypeList();

    Page<BpOtherSafetyWorkSearchBean> getOtherSafetyWorkList(Pageable page, OtherSafetyWorkSearchBean bean);

    ResultBean safetyStatistics(Pageable pageable, BpSafetyStatisticsSearchBean condition);

    List<SimpleSelectListBean> getSafetyStateList();
}
